package com.paziy.jan.graphics.figures;

import com.paziy.jan.graphics.Color;
import com.paziy.jan.graphics.Graph;
import com.paziy.jan.graphics.Movable;

public class Point extends Graph implements Movable {

    private static final Color DEFAULT_COLOR = new Color("Red");

    private static final int DEFAULT_X = 0;
    private static final int DEFAULT_Y = 0;

    private int x = DEFAULT_X;
    private int y = DEFAULT_Y;

    public Point() {
        super(DEFAULT_COLOR);
    }

    public Point(int x, int y) {
        this();
        setX(x);
        setY(y);
    }

    public Point(int x, int y, Color color) {
        super(color);
        setX(x);
        setY(y);
    }

    private void setX(int newX) {
        x = newX;
    }

    private void setY(int newY) {
        y = newY;
    }

    @Override
    public int getX() {
        return x;
    }

    @Override
    public int getY() {
        return y;
    }

    @Override
    public void draw() {
        System.out.println(toString());
    }

    @Override
    public void moveTo(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public void move(int dX, int dY) {
        x += dX;
        y += dY;
    }

    @Override
    public String toString() {
        return "Point: x: " + x + "; y: " + y + "; " + getColor() + ";";
    }
}
